<?php
	require "settings/config.php";
	require "layout.php";
	require "includes/session.php";
	require "includes/sql_functions.php";
	require "includes/slot_functions.php";
	
	oh_require_admin();
	
	render_header("Administer Game Slots");
	
	if($_GET['deleted']==1)
	{
		echo "Slot deleted.<br />";
	}
	
	if($_GET['delete'])
	{
		echo "<div style=\"display:inline-block;vertical-align:top;padding:0.5em\">";
		echo "<b>Confirm deletion of slot ".$_GET['delete'].":</b>\n<br /><br />";
		make_button("Confirm","do_slotkill.php?delete=".$_GET['delete']);
		make_button("Cancel","slots.php");
		echo "</div>";	
	}
		
?>

	
	<div style="display:inline-block;vertical-align:top;padding:0.5em">
	<b>Add a timeslot:</b>
<?php
	if($_GET['baddate']==1)
		echo "Invalid date entered.";
		
	if($_GET['success']==1)
		echo "Timeslot added.";
		
	if($_GET['success']==1)
		echo "Timeslot updated.";
		
?>
	<br />
	<form action="do_slotadd.php" method="POST">
	Year - Month - Day:<br />
	<input type="text" name="year" size="4" class="inputbox">-<input type="text" name="month" size="2" class="inputbox">-<input type="text" name="day" size="2" class="inputbox"><br />
	
	Start Hour : Minute <span class="smalltext">(24 hour)</span>: <br />
	<input type="text" name="hour" size="2" class="inputbox">:<input type="text" name="minute" size="2" class="inputbox"> <br />
	
	Duration <span class="smalltext">(hours)</span>  <br /> 
	<input type="text" name="duration" size="2" class="inputbox"><br />
	
	<span class="smalltext">Note: For games which will span multiple timeslots,</br>
	consider creating a multi-slot game rather than an extended timeslot.</span>
	<br />	
	<input type="submit" class="button" value="Add Timeslot">
	</form>
	</div>
	

	
	<div style="display:inline-block;vertical-align:top;padding:0.5em">	
	<b>Current timeslots:</b><br />
<?php
	oh_render_slot_table();
?>
	</div>
<?php
	render_footer();
?>